home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / m / motion_master / motiomasterii2.dms / motiomasterii2.adf / lwm / getpoints.lwm
Text File  |  1991-07-18  |  2KB  |  88 lines

  1. /* getpoints.rexx */
  2. /* get vertices for particle animation */
  3. address "LWModelerARexx.port"
  4. libadd = addlib("LWModelerARexx.port",0)
  5. SIGNAL ON ERROR
  6. SIGNAL ON SYNTAX
  7. MATHLIB="rexxmathlib.library"
  8. IF POS(MATHLIB , SHOW('L')) = 0 THEN
  9.   IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
  10.    call notify(1,"!Can't find "MATHLIB)
  11.    exit
  12.    END
  13. type = 1
  14. call req_begin "Grab Particle Positions"
  15.  
  16. id_txt = req_addcontrol("Choose source or target", 'T', "position")
  17. id_type = req_addcontrol("", 'CH','Source Target')
  18.  
  19. call req_setval id_type, type
  20.  
  21. if (~req_post()) then do
  22.   call req_end
  23.   req=0
  24.   exit
  25.   end
  26.  
  27. type =req_getval(id_type)
  28. call req_end
  29.  
  30.  
  31. If type = 1 then do
  32. File.name = 't:Source'
  33. end
  34. If type = 2 then do
  35.   File.name = 't:Target'
  36. end
  37. t=time('e')
  38. n = xfrm_begin()
  39.  
  40.  call meter_begin n+1 , "Grabbing "n" points," ,"  Be right with you."
  41. do i = 1 to n by 1
  42. /* say i */
  43.   parse value xfrm_getpos(i) with x y z .
  44. If i = 1  Then do
  45.       call writeheader(mot,x ||" "|| y ||" "|| z)
  46. end
  47. If i ~= 1     Then Do
  48.       call writekey(mot,x ||" "|| y ||" "|| z)
  49.   end
  50.  call meter_step
  51. end
  52. call xfrm_end
  53. call meter_end
  54. call close mot
  55. t=time('e')-t
  56. say 'Whew, I just transformed 'n' points in only 't' seconds.'
  57. call notify(1,'!Holy Smoke, I just grabbed 'n' points','!in only 't'
  58. seconds.')
  59. if (libadd) then call remlib("LWModelerARexx.port")
  60.  
  61. Exit
  62.  
  63. Writekey: PROCEDURE EXPOSE i x y z.
  64.   arg MotFile, Keys
  65.     call writeln(MotFile,Keys)
  66.  
  67.   return 1
  68.  
  69.  
  70. WriteHeader: PROCEDURE EXPOSE file.
  71.   arg MotFile, keys
  72. if open(MotFile,File.name,'W') then do
  73.     call writeln(MotFile,keys)
  74.  end
  75.   else do
  76. say    "Bummer Can't open Motion file ; "|| File.name
  77.   end
  78.   return 1
  79.  
  80. SYNTAX:
  81. ERROR:
  82.   say 'Sorry, Error #'RC' on line 'SIGL' has been detected.'
  83.   say errortext(rc)
  84.   say sourceline(SIGL)
  85.   t=notify(1,'!Total Bummer Dude!','!An error has been detected.','@'ErrorText(rc),'Line 'SIGL)
  86.   call end_all
  87.   exit
  88.